#include<bits/stdc++.h>
# define rep(i, j, k) for (int i = j; i <= k; ++i)
using namespace std;

int n, cnt, plc[105], num[105], nw[105], suf[105], pre[105], ans;
int lg2[105], stmax[105][5];
string s, t;

signed main()
{
    freopen("bracket.in", "r", stdin);
    freopen("bracket.out", "w", stdout);
    ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
    cin >> n >> s; s = ' ' + s, t = s;
    rep(i, 1, n) if (s[i] == 'x') plc[++cnt] = i;
    rep(i, 0, (1 << cnt) - 1)
    {
        rep(j, 1, cnt) if ((i >> (j - 1)) & 1) t[plc[j]] = '('; else t[plc[j]] = ')';
        rep(j, 1, n) num[j] = num[j - 1] + (t[j] == '(' ? 1 : -1);
        suf[n] = num[n]; for (int j = n - 1; j; --j) suf[j] = min(suf[j + 1], num[j]);
        bool b = false;
        rep(j, 1, n)
        {
            if (b) break;
            rep(k, 1, n) nw[k] = nw[k - 1] + (t[k] == '(' ? 1 : -1);
            rep(k, j, n)
            {
                nw[k] = nw[k - 1] + (t[k] == '(' ? -1 : 1); if (nw[k] < 0) break;
                if (nw[k] - num[k] == -num[n] && (suf[k + 1] + nw[k] - num[k] >= 0 || k == n)) {++ans; b = true; break;}
            }
            if (num[j] < 0) break;
        }
    }
    cout << ans << '\n';
    return 0;
}
